package org.hiucung.hlsdownloader.view

import android.annotation.SuppressLint
import android.content.Context
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer

/**
 * @title: ComposeGSYVideoPlayer
 * @projectName HLS Downloader
 * @description: GSYVideoPlayer组合控件
 * @author Kicc
 * @date 2025/8/31 16:26
 */
@SuppressLint("ViewConstructor")
class ComposeGSYVideoPlayer @JvmOverloads constructor(
    context: Context,
    // 你可以根据需要添加更多参数，如 URL、标题等，在 Composable 中传入
    var videoUrl: String? = null,
    var videoTitle: String? = null
) : StandardGSYVideoPlayer(context) {

    init {
        layoutParams = LayoutParams(
            LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT
        )
        // 这里可以进行一些初始配置
    }

    fun setVideoData(url: String?, title: String?) {
        this.videoUrl = url
        this.videoTitle = title
        setUp(url, false, title) // false 表示不缓存
    }
}